<include file="public@header"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>

</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('customer/add')}">新建客户</a></li>
        <li><a href="{:url('customer/index')}">客户列表</a></li>     
        <li class="active"><a href="javascript:;">编辑客户信息</a></li>
    </ul>
    <form action="{:url('Customer/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
        <input type="hidden" name='id' value="{$result.id}">
        <div class="row">
            <div class="col-md-9">
                <table class="table table-bordered">
                    <tr>
                        <th>客户姓名<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="post[customer_name]"
                                    required value="{$result.customer_name}" placeholder="请输入客户姓名"/>
                        </td>
                    </tr>
                    
                    <tr>
                        <th>手机号码<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="post[customer_mobile]"
                                   required value="{$result.customer_mobile}" placeholder="请输入手机号码"/>
                        </td>
                    </tr>

                    <tr>
                        <th>性别</th>
                        <td>
                            <input type="radio" name="post[customer_sex]"
                                  value="男" <?php if($result['customer_sex'] == '男'){ echo 'checked'; }?> />男
                            &nbsp;&nbsp;
                            <input type="radio" name="post[customer_sex]"
                                  value="女" <?php if($result['customer_sex'] == '女'){ echo 'checked'; }?>/>女
                        </td>
                    </tr>

                    


                    <tr>
                        <th>QQ</th>
                        <td>
                            <input class="form-control" type="text" name="post[customer_qq]"
                                 value="{$result.customer_qq}" placeholder="请输入QQ"/>
                        </td>
                    </tr>

                    <tr>
                        <th>微信</th>
                        <td>
                            <input class="form-control" type="text" name="post[customer_wx]"
                                    value="{$result.customer_wx}" placeholder="请输入微信"/>
                        </td>
                    </tr>
                    
                    <tr>
                        <th>邮箱</th>
                        <td>
                            <input class="form-control" type="text" name="post[customer_email]"
                                     value="{$result.customer_email}" placeholder="请输入邮箱"/>
                        </td>
                    </tr>

                    <tr>
                        <th>公司职务</th>
                        <td>
                            <input class="form-control" type="text" name="post[customer_job]"
                                     value="{$result.customer_job}" placeholder="请输入职务"/>
                        </td>
                    </tr>

                    <tr>
                        <th width="100">公司名称<span class="form-required"></span></th>
                        <td>
                            <input class="form-control" type="text" style="width:400px;" value="{$result.company_name}"
                                   placeholder="点击选择" onclick="company();" id='company_name' 
                                   readonly/>
                           <input type="hidden" id='company_id' name='post[company_id]' value="{$result.company_id}">
                        </td>
                    </tr>
                    
               

                    <tr>
                        <th width="100">项目信息<span class="form-required"></span></th>
                        <td>
                               <foreach name='company_project_result' item='vo'>
                                       <input type='checkbox' name='all_project[]' value="{$vo.id}" <?php if($vo['is_checked']  == 'true'){ echo 'checked';}?>>{$vo.project_name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                               </foreach>
                        </td>
                    </tr>
                   
                  
                    <tr>
                        <th>备注</th>
                        <td>
                            <script type="text/plain" id="content" name="post[desc]">{$result.desc}</script>
                        </td>
                    </tr>
                   
                    
                </table>
                <hook name="portal_admin_article_edit_view_main"/>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
                        <a class="btn btn-default" href="{:url('customer/index')}">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                

                <hook name="portal_admin_article_edit_view_right_sidebar"/>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });

    function company() {

        openIframeLayer("{:url('Company/find')}", '公司查找', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {

                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var all = iframeWin.confirm();

                $('#company_name').val(all.company_name);
                $('#company_id').val(all.company_id);
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }

     function project() {

        openIframeLayer("{:url('project/find')}", '项目查找', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {

                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var all = iframeWin.confirm();

                $('#project_id').val(all.project_id);
                $('#project_name').val(all.project_name);
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }
</script>
</body>
</html>
